package com.sxpi.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sxpi.user.pojo.User;
import org.apache.ibatis.annotations.Param;

/**
 * @Author: 董伟豪
 * @Date: 2022/10/3 15:23
 */
public interface UserMapper extends BaseMapper<User> {

    /**
     * 写了一个悲观锁
     * @param userId
     * @return
     */
    User selectUserPessimismLock(@Param("userId")Long userId);

    /**
     * 乐观锁的方式完成用户提现
     * @return
     */
    int updateUserAmount(@Param("userId")Long userId,@Param("money")Double money,@Param("version")Integer version);
}
